import time
from selenium import webdriver

options = webdriver.ChromeOptions()
options.add_experimental_option('excludeSwitches', ['enable-automation'])
options.add_argument("--disable-blink-features=AutomationControlled")
driver = webdriver.Chrome(options=options)
driver.get("https://www.wegame.com.cn/home")
driver.maximize_window()
time.sleep(3)

# 点击登录跳出登录界面
driver.find_element("xpath", "//div[@class='wglogin']").click()
time.sleep(3)

# 切换标签
driver.switch_to.frame(driver.find_element("xpath", "//iframe[@src='https://xui.ptlogin2.qq.com/cgi-bin/xlogin?s_url=https%3A%2F%2Fwww.wegame.com.cn%2Flogin%2Fcallback.html%3Ft%3Dqq%26c%3D0%26a%3D0&appid=1600001063&daid=733&style=20&pt_no_auth=0&target=self&hide_close_icon=1&hide_border=1']"))
time.sleep(2)
# 点击密码登录
driver.find_element("xpath", "//div[@class='bottom hide']/a[@id='switcher_plogin']").click()
time.sleep(1)

# 输入账号密码
driver.find_element("xpath", "//div[@class='uinArea']//input[@class='inputstyle']").send_keys("2048663955")
driver.find_element("xpath", "//div[@class='pwdArea']//input[@class='inputstyle password']").send_keys("22571040wlq")

# 再次点击登录
driver.find_element("xpath", "//div[@class='submit']/a[@id='switcher_plogin']").click()
